import { h } from "vue";
import { ElMessageBox } from "element-plus";

export default function (obj, title = "Pre message") {
  let msg = null;
  try {
    msg = JSON.stringify(obj, null, 2);
    ElMessageBox({
      title,
      message: h("pre", {
        style: {
          maxHeight: "calc(100vh - 200px)",
          width: "800px",
          maxWidth: "calc(100vw - 200px)",
          overflow: "auto",
          padding: "8px",
          border: "1px solid #8888",
          borderRadius: "8px",
          backgroundColor: "#8882",
        },
        msg,
      }),
      showModel: false,
    });
  } catch (err) {
    console.log("pre...", obj);
  }
}
